<div class="nav">
    <a href="{:U('index')}">手机App模块列表</a>
    <a class="sel" href="#">编辑手机App模块</a>
</div>
<div class="add">
    <form method="post" action="" >
        <table class="table_add">
            <tr>
                <td width="100px">模块风格</td>
                <td><select name="style_id" id="style_id" class="sel1">
                        <foreach name="style_list" item="style_item">
                            <option value="{$style_item.style_id}">{$style_item.style_name}</option>
                        </foreach>
                    </select> </td>
                 <td rowspan="8" style="wdith:450px">
                        <div id="demo_picture_list">
                        <foreach name="style_list" item="style_item">
                            <img src="__ROOT__{$style_item.demo_picture}" id="demo_pic_{$style_item.style_id}" width="300px" style="display:none" />
                        </foreach>
                        </div>
                    </td>
            </tr>
            <tr style="display:none">
                <td width="100px">楼层名称</td>
                <td><input class="input1" type="text" name="floor_name" id="floor_name" value="{$model.floor_name}" style="width:140px" /> </td>
            </tr>
            <tr>
                <td width="100px">模块名称</td>
                <td><input class="input1" type="text" name="block_name" id="block_name" value="{$model.block_name}" style="width:140px" /> </td>
            </tr>
                    <tr>
                <td width="100px">模块英文名称</td>
                <td><input class="input1" type="text" name="block_name_en" id="block_name_en" value="{$model.block_name_en}" style="width:140px" /> </td>
            </tr>
             <tr>
                <td width="100px">模块名称颜色</td>
                <td><input class="input1" type="text" name="block_name_color" id="block_name_color" value="{$model.block_name_color}" style="width:50px" /></td>
            </tr>
            <tr style="display:none">
                <td width="100px">关联类别</td>
                <td><select name="cat_id" id="cat_id" class="sel1">
                        <option value="0">不关联类别</option>
                        <foreach name="goods_cat" item="goods_cat_item">
                            <option value="{$goods_cat_item.cat_id}">{$goods_cat_item.cat_name}</option>
                        </foreach>
                    </select> </td>
            </tr>
            
            <tr style="display:none">
                <td>ICO图标</td>
                <td>
                <include file="Public/uploadfile" filetype="image" id="ico"  value="{$model.ico}" editvalue="{:getEditFiles($model['ico'])}" width="100" path="index" limit="1" thumbw="" thumbh="" msg=""/>

                </td>
            </tr>
            <tr>
                <td width="100px">更多地址</td>
                <td ><input class="input1" type="text" name="more_url" id="more_url" value="{$model.more_url}" style="width:500px" /> </td>
            </tr>
            <tr  style="display:none">
                <td>子类别</td><td  colspan="2">
                    <table class="table_pro_spec" id="table_pro_spec">
                      <foreach name="model.spec_arr" key="i" item="spec_item">
                      <tr id="tr_{$i}"><td>类别名：<input type="text" style="width:160px"  value="{$spec_item.k}" name="spec_t[]" /> 链接：<input type="text" style="width:400px"  name="spec_v[]" value="{$spec_item.v}" /></td><td><img onclick="del_tr({$i})" src="__PUBLIC__/admin/images/no1.gif" /></td></tr>
                      </foreach>
                  </table>
                  <input type="button"  onclick="add_spec()" class="btn2" value="新增" />
                  <input type="hidden" id="spec_count" value="{:count($model['spec_arr'])}" />
                </td>
            </tr>
            <tr>
                <td width="100px">顺序编号</td>
                <td ><input class="input1" type="text" name="order_id" id="order_id" value="{$model.order_id}" style="width:60px" /> <span class="msg">*</span></td>
            </tr>
            <tr>
                <td width="100px">是否显示</td>
                <td  ><select name="is_enable" id="is_enable" class="sel1">
                        <option value="1">显示</option>
                        <option value="0">不显示</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td></td>
                <td  ><input type="submit" class="btn1" value="提 交" />  &nbsp; <input class="btn3"  type="button" onclick="window.history.back()" value="返 回" /></td>
            </tr>
        </table>
        <input type="hidden" name="block_id" value="{$model.block_id}" />
    </form>
     <link rel="stylesheet" type="text/css" href="__PUBLIC__/common/colorpicker/evol.colorpicker.min.css" />
    <script src="__PUBLIC__/common/jquery-ui-1.8.9.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="__PUBLIC__/common/colorpicker/evol.colorpicker.min.js" ></script>
    <script type="text/javascript" >
        $("#block_name_color").colorpicker();
        $("#style_id").val("{$model.style_id}");
        $("#cat_id").val("{$model.cat_id}");
        $("#is_enable").val("{$model.is_enable}");
        $("#demo_pic_{$model.style_id}").show();
        
        $("#style_id").change(function(){
            var style_id = $("#style_id").val();
            $("#demo_pic_"+style_id).show().siblings().hide();
        })

        function add_spec() {
            var spec_count = parseInt($("#spec_count").val());
            var i = spec_count + 1;
            var tr_html = '';
            tr_html += '<tr id="tr_' + i + '"><td>类别名：<input type="text" style="width:160px"  name="spec_t[]" /> 链接：<input type="text" style="width:400px"  name="spec_v[]" /></td><td><img onclick="del_tr(' + i + ')" src="__PUBLIC__/admin/images/no1.gif" /></td></tr>';
            $("#table_pro_spec").append(tr_html);
            $("#spec_count").val(i);
        }

        function del_tr(i) {
            $("#tr_" + i).remove();
        }
    </script>
</div>
